#include <stdio.h>
#include "dlm.h"


struct  __dynamic_function_pool FxPool;


int main(int argc, char* argv[])
{
	fx_pool_construct(&FxPool);
#ifdef OS_Linux
	load_dynamic_module("libdl1.so", &FxPool);
#endif
#ifdef OS_Cygwin
	load_dynamic_module("cygdl1.dll", &FxPool);
#endif

	fx_pool_list(&FxPool);
#ifdef OS_Linux
	FUNC_ENTRY f0 = fx_get_entry("libdl1.so", 
								"print", 
								&FxPool);

	FUNC_ENTRY f1 = fx_get_entry("libdl1.so", 
								"intadd", 
								&FxPool);
#endif

#ifdef OS_Cygwin
	//#error "Host platform: Windows Cygwin"
	FUNC_ENTRY f0 = fx_get_entry("cygdl1.dll", 
								"print", 
								&FxPool);

	FUNC_ENTRY f1 = fx_get_entry("cygdl1.dll", 
								"intadd", 
								&FxPool);
#endif

	((void (*)(void))f0)();
	((int (*)(int,int))f1)(3, 8);

	fx_pool_release(&FxPool);
}